﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<script src="~/Content/my/MyAjaxForm.js"></script>
<script>
    var imgFileName;
    var keyValue = $.request("keyValue");
    $(function () {
        if (!!keyValue) {
            $.ajax({
                url: "/BusinessManage/D_Goods/GetFormJson",
                data: { keyValue: keyValue },
                dataType: "json",
                async: false,
                success: function (data) {
                    $("#form1").formSerialize(data);
                }
            });
        }
         $("#btn_show").click(function(){
            var a= $("#F_Picu").val();
            if(a==""){
                $.modalMsg("请选择图片","warning");
                return;
            }
             $("#form1").ajaxSubmit({
                 URL: "/BusinessManage/D_Goods/FileUpload",
                 type:"post",
                 success: function (imgFileData) {
                    $("#F_Pic").val(imgFileData);
                    $.modalMsg("上传成功","success");
                 }
             });
         });
    });
    function submitForm() {
        if (!$('#form1').formValid()) {
            return false;
        }
        $.submitForm({
            url: "/BusinessManage/D_Goods/SubmitForm?keyValue=" + keyValue,
            param: $("#form1").formSerialize(),
            success: function () {
                $.currentWindow().$("#gridList").resetSelection();
                $.currentWindow().$("#gridList").trigger("reloadGrid");
            }
        })
    }
</script>

<form id="form1" enctype="multipart/form-data" action="/BusinessManage/D_Goods/FileUpload">
    <div style="padding-top: 20px; margin-right: 20px;">
        <table class="form">
            <tr>
                <th class="formTitle">名称</th>
                <td class="formValue" colspan="3">
                    <input id="F_Name" name="F_Name" type="text" class="form-control required" placeholder="请输入名称" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">价格</th>
                <td class="formValue">
                    <input id="F_Price" name="F_Price" type="number" class="form-control required" readonly placeholder="请输入价格" value="@NFine.Domain.Entity.BusinessManage.SalaryChangeType.TypeValues.公司进入一个点位" />
                </td>
                <th class="formTitle">规格</th>
                <td class="formValue">
                    <input id="F_Spec" name="F_Spec" type="text" class="form-control required" placeholder="请输入规格" />
                </td>
                @*<th class="formTitle">积分</th>
                <td class="formValue">
                    <input id="F_Inte" name="F_Inte" type="number" class="form-control required" placeholder="请输入积分" />
                </td>*@
            </tr>
            <tr>                
                <td class="formValue"></td>
                <td class="formValue" style="padding-top: 1px;">
                    <div class="ckbox">
                        <input id="F_State" name="F_State" type="checkbox" checked="checked"><label for="F_State">有效</label>
                    </div>
                </td>
            </tr>
            <tr>
                <th class="formTitle">图片</th>
                <td class="formValue" colspan="3">
                    <input id="F_Picu" name="F_Picu" type="file" class="form-control" placeholder="请输入图片" />
                    <input type="hidden" id="F_Pic" name="F_Pic" />
                </td>
                <td class="formValue">
                    <input type="button" id="btn_show" name="btn_show" value="上传图片" />
                </td>
            </tr>
            <tr>
                <th class="formTitle" valign="top" style="padding-top: 5px;">
                    商品描述
                </th>
                <td class="formValue" colspan="3">
                    <textarea id="F_Summary" name="F_Summary" class="form-control" style="height: 60px;"></textarea>
                </td>
            </tr>
        </table>
    </div>
</form>
